{extend name="public/nav"}

{block name="main"}
<div class="admin-content">
    <div class="am-cf am-padding">
      <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">密码修改</strong> / <small>Change Password</small></div>
    </div>

    <hr/>

    <div class="am-g">

      <div class="am-u-sm-8 am-u-md-4 am-u-md-push-8">

      </div>

      <div class="am-u-sm-8 am-u-md-8 am-u-md-pull-4">
        <form class="am-form am-form-horizontal" method="post" action="{:U('user/setpassword')}" id="conf_update">
          <div class="am-form-group">
            <label for="user-name" class="am-u-sm-4 am-form-label">原始密码 / Dreambox</label>
            <div class="am-u-sm-8">
              <input type="password" id="user-name" placeholder="原始密码 / Dreambox" name="dreambox">
              <!-- <small>输入你的名字，让我们记住你。</small> -->
            </div>
          </div>

          <div class="am-form-group">
            <label for="user-email" class="am-u-sm-4 am-form-label">修改密码 / Change password</label>
            <div class="am-u-sm-8">
              <input type="password" id="user-email" placeholder="修改密码 / Change password" name="chpassword">
            </div>
          </div>

          <div class="am-form-group">
            <label for="user-phone" class="am-u-sm-4 am-form-label">确认密码 / Confirm Password</label>
            <div class="am-u-sm-8">
              <input type="password" id="user-phone" placeholder="确认密码 / Confirm Password" name="copassword" >
            </div>
          </div>

          <div class="am-form-group">
            <div class="am-u-sm-8 am-u-sm-push-4">
                <input type="hidden" name="update_time" value="{:time()}">
                <input type="submit" class="am-btn am-btn-primary" value="保存修改">
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
{/block}

{block name="js"}
<script type="text/javascript">
    $('#conf_update').submit(function() {
        var index = layer.load(2);

        $(this).ajaxSubmit(function(data){
            layer.close(index);
            if(data == 1){
                layer.msg('密码更改成功，请重新登录。。', {time: 2000},function(){
                    location.href="{:U('index/index')}";
                });
            }else{
                layer.alert(data,{
                    icon:2,
                });
            }
        })
        return false;
    })
</script>
{/block}

